package tax_return;

/**
2 A tax return of a taxpayer in 2008.
3 */

public class TaxReturn{

	public static final int SINGLE = 1;
	public static final int MARRIED = 2;
	private static final double RATE1 = 0.10;
	private static final double RATE2 = 0.25;
	private static final double RATE1_SINGLE_LIMIT = 32000;
	private static final double RATE1_MARRIED_LIMIT = 64000;
	private double income;
	private double rate1Limit;
	private int status;

/**
18 Constructs a TaxReturn object for a given income and
19 marital status.
20 @param anIncome the taxpayer income
21 @param aStatus either SINGLE or MARRIED
22 */

	public TaxReturn(double anIncome, int aStatus){
		income = anIncome;
		status = aStatus;
	}
	
	public double getTax(){
		double tax1 = 0;
		double tax2 = 0;
		rate1Limit = status==SINGLE ? RATE1_SINGLE_LIMIT : RATE1_MARRIED_LIMIT;
		if (income <= rate1Limit){
			tax1 = RATE1 * income;
		}
		else{
			tax1 = RATE1 * rate1Limit;
			tax2 = RATE2 * (income - rate1Limit);
		}
		
		return tax1 + tax2;
	}
}
	